#!/bin/sh
CURDIR=`pwd | sed 's|/work/.*||'`
cd $CURDIR
if [ -d files ]; then mv -f files files-`date +%s`; fi
mkdir files
PATCH_WRKSRC=`make -V PATCH_WRKSRC`
cd $PATCH_WRKSRC
for old in `find * -name "*.orig"`; do
  new=`echo $old | sed 's/\.orig//'`
  echo Generating patch for $new
  diff -ruN $old $new > $CURDIR/files/patch-`echo $new | sed 's,/,__,g'`
done
